<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="col-sm-12 select-info">
			<form id="query-form">
				<div class="select-list">
					<ul>
						<li>
							业务名：<input type="text" name="objectname"/>
						</li>
						<li>
							属性名：<input type="text" name="attributename"/>
						</li>
						<li>
							搜索内容：<input type="text" name="searchValue"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="tableSearch()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="btn-group hidden-xs" id="toolbar" role="group">
<!--			<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="module:maxAttribute:add">-->
<!--				<i class="fa fa-plus"></i> 新增-->
<!--			</a>-->
<!--			<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.removeAll()" shiro:hasPermission="module:maxAttribute:remove">-->
<!--				<i class="fa fa-trash-o"></i> 删除-->
<!--			</a>-->
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true" style="white-space:nowrap"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:maxAttribute:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module:maxAttribute:remove')}]];
        var prefix = ctx + "module/maxAttribute"

        $(function() {
            var options = {
				search: false,
				url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "属性配置",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'maxAttributeId',
					title : '主键'
				},
				{
					field : 'objectname',
					title : '业务对象的名称'
				},
				{
					field : 'attributename',
					title : '属性名'
				},
				{
					field : 'alias',
					title : '别名'
				},
				{
					field : 'title',
					title : '标题'
				},
				{
					field : 'remarks',
					title : '备注'
				},
				{
					field : 'persistent',
					title : '持久性'
				},
				{
					field : 'enTitle',
					title : '英文标题'
				},
				{
					field : 'enRemarks',
					title : '英文备注'
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.maxAttributeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.maxAttributeId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        function tableSearch(formId) {
			var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
			var params = $("#bootstrap-table").bootstrapTable('getOptions');
			params.queryParams = function(params) {
				var search = {};
				$.each($("#" + currentId).serializeArray(), function(i, field) {
					search[field.name] = field.value;
				});
				search.pageSize = params.limit;
				search.pageNum = params.offset / params.limit + 1;
				search.orderByColumn = params.sort;
				search.isAsc = params.order;
				return search;
			}
			$("#bootstrap-table").bootstrapTable('refresh', params);
		}
	</script>
</body>
</html>
